import { Controller, Get, Post, Body, Patch, Param, Delete, Query, Headers, HttpCode } from '@nestjs/common';
import { XiaomanService } from './xiaoman.service';
import { CreateXiaomanDto } from './dto/create-xiaoman.dto';
import { UpdateXiaomanDto } from './dto/update-xiaoman.dto';

@Controller('xiaoman')
export class XiaomanController {
  constructor(private readonly xiaomanService: XiaomanService) {}

  @Post()
  create(@Body() createXiaomanDto: CreateXiaomanDto) {
    return this.xiaomanService.create(createXiaomanDto);
  }

  @Get()
  @HttpCode(500)
  findAll(@Headers() headers) {
    return this.xiaomanService.findAll(headers);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.xiaomanService.findOne(+id);
  }

  @Get(':id')
  findOneByQuery(@Query('id') id:string) {
    return this.xiaomanService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateXiaomanDto: UpdateXiaomanDto) {
    return this.xiaomanService.update(+id, updateXiaomanDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.xiaomanService.remove(+id);
  }
}
